package domain;

import java.util.Date;
import java.util.Objects;

/**
 * 社团成员申请类
 *
 * @author liujiale
 */
public class MembershipApplication extends Application {

    /** 社团成员申请ID */
    private int membershipApplicationID;

    /** 申请加入的社团ID */
    private int requestedClubID;

    /**
     * 构造函数
     *
     * @param membershipApplicationID 社团成员申请ID
     * @param requestedClubID         申请加入社团ID
     */
    public MembershipApplication(int membershipApplicationID, int requestedClubID) {
        this.membershipApplicationID = membershipApplicationID;
        this.requestedClubID = requestedClubID;
    }

    /**
     * 实现父类的构造函数
     *
     * @param applicationTime         申请时间
     * @param applicant               申请人
     * @param status                  申请状态
     * @param description             描述
     * @param membershipApplicationID 社团成员申请ID
     * @param requestedClubID         申请加入社团ID
     */
    public MembershipApplication(Date applicationTime, StudentAccount applicant, int status, String description, int membershipApplicationID, int requestedClubID) {
        super(applicationTime, applicant, status, description);
        this.membershipApplicationID = membershipApplicationID;
        this.requestedClubID = requestedClubID;
    }

    /**
     * 实现父类的构造函数
     *
     * @param applicationTime         申请时间
     * @param status                  申请状态
     * @param description             描述
     * @param membershipApplicationID 社团成员申请ID
     * @param requestedClubID         申请加入社团ID
     */
    public MembershipApplication(int membershipApplicationID, int requestedClubID, Date applicationTime, int status, String description) {
        super(applicationTime, status, description);
        this.membershipApplicationID = membershipApplicationID;
        this.requestedClubID = requestedClubID;
    }

     public MembershipApplication() {

	}

	/**
     * Gets membership application id.
     *
     * @return the membership application id
     */
    public int getMembershipApplicationID() {
        return membershipApplicationID;
    }

    /**
     * Sets membership application id.
     *
     * @param membershipApplicationID the membership application id
     */
    public void setMembershipApplicationID(int membershipApplicationID) {
        this.membershipApplicationID = membershipApplicationID;
    }

    /**
     * Gets requested club id.
     *
     * @return the requested club id
     */
    public int getRequestedClubID() {
        return requestedClubID;
    }

    /**
     * Sets requested club id.
     *
     * @param requestedClubID the requested club id
     */
    public void setRequestedClubID(int requestedClubID) {
        this.requestedClubID = requestedClubID;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof MembershipApplication)) {
            return false;
        }
        if (!super.equals(o)) {
            return false;
        }
        MembershipApplication that = (MembershipApplication) o;
        return membershipApplicationID == that.membershipApplicationID && requestedClubID == that.requestedClubID;
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), membershipApplicationID, requestedClubID);
    }

    @Override
    public String toString() {
        return "MembershipApplication{" +
                "membershipApplicationID=" + membershipApplicationID +
                ", requestedClubID=" + requestedClubID +
                '}';
    }
}
